package net.eearley.redpoint.app;

 
/**
 * The Enum Denomination.
 */
public enum Denomination {
	
	/** The SINGLE. */
	SINGLE(1) {
	},
	
	/** The FIVE. */
	FIVE(5) {
	},
	
	/** The TEN. */
	TEN(10) {
	},
	
	/** The TWENTY. */
	TWENTY(20) {
	},
	
	/** The HUNDRED. */
	HUNDRED(100) {
	};
	
	/** The value. */
	private int value;

	/**
	 * Instantiates a new denomination.
	 * 
	 * @param value the value
	 */
	private Denomination(int value) {
		this.value = value;
	}

	/**
	 * From int.
	 * 
	 * @param val the val
	 * 
	 * @return the denomination
	 */
	public static Denomination fromInt(Integer val) {
		if (val != null) {
			for (Denomination d : Denomination.values()) {
				if (val.equals(d.value)) {
					return d;
				}
			}
		}
		return null;
	}

	/* (non-Javadoc)
	 * @see java.lang.Enum#toString()
	 */
	@Override
	public String toString() {
		return "$" + value;
	}

	/**
	 * Gets the val.
	 * 
	 * @return the val
	 */
	public Integer getVal() {
		return value;
	}

}
